options ps=MAX ls=MAX nodate nonumber nocenter;
*options nonotes nosource nosource2 errors=0;



* CHANGING THE WORK DIRECTORY; 
libname user "D:\Olivier\Documents\Sas"; *USER FOLDER;
libname my_files "D:\Olivier\Owncloud\Research\Work_Segregation\Coin_Shared_Programs\Example_dta"; *ORIGIN FOLDER;
libname rec "D:\Olivier\Documents\Sas\Output\"; *OUTPUT FOLDER;
libname est_comp "D:\Olivier\Documents\Sas\Temp\"; *Temporary folder for storing establishment files further used in regressions;



Title;

proc format;
value orgsize
	0="a.orgsize0"
	1="b.orgsize1"
	2-20="c.orgsize2"
	21-50="d.orgsize20"
	51-100="e.orgsize50"
	101-200="f.orgsize100"
	201-500="g.orgsize200"
	501-1000="h.orgsize500"
	1001-2500="i.orgsize1000"
	2501-5000="j.orgsize2500"
	5001-10000="k.orgsize5000"
	10001-10000000="l.orgsize10000_plus"
	;
run;


data est ; 
set 
est_comp.b1990est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1991est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1992est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1993est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1994est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1995est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1996est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1997est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1998est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b1999est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2000est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2001est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2002est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2003est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2004est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2005est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2006est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2007est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2008est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2009est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2010est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2011est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2012est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2013est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2014est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2015est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2016est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2017est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )
est_comp.b2018est (keep=est sector sector_agg nuts1  F0025 F2575 F7590 F9099 F9910 count  year )

;

F9010=F9910+F9099;

*if YEAR<2008 then div=PUT(UPCASE(COMPRESS(sector)),$naf03_naf08_.);
*else div=sector;

if count>1 then do; 
		if F9910>0 then do;
			F9910xF0025=(F0025)/(count-1);
			F9910xF7590=(F7590)/(count-1);
			F9910xF9910=(F9910-1)/(count-1);
		end;
		if F9010>0 then do;
			F9010xF0025=(F0025)/(count-1);
			F9010xF7590=(F7590)/(count-1);
			F9010xF9010=(F9010-1)/(count-1);
		end;
	end;
orgsize=PUT(count,orgsize.);
lncount=log(count);
run;


proc sql; 
		create table est2 as SELECT *, 
									count(F9010) as nF9010, 
									count(F9910) as nF9910, 
									sum(F9010) as sF9010, 
									sum(F9910) as sF9910
									from est group by year; 
		quit;

proc datasets lib=user;
 	delete est; 
run;

proc sql; 
		create table est3 as SELECT *, 
                  sum(count) as s_nuts1, 
									sum(F9010) as sF9010_nuts1, 
									sum(F9910) as sF9910_nuts1
									from est2 group by nuts1, year; 
		quit;

proc datasets lib=user;
 	delete est2; 
run;

proc sql; 
		create table est4 as SELECT *, 
									sum(count) as s_sec, 
									sum(F9010) as sF9010_sec, 
									sum(F9910) as sF9910_sec
									from est3 group by sector_agg, year; 
		quit;

proc datasets lib=user;
 	delete est3; 
run;

proc sql; 
		create table est5 as SELECT *, 
									sum(count) as s_sz, 
									sum(F9010) as sF9010_sz, 
									sum(F9910) as sF9910_sz
									from est4 group by orgsize, year; 
		quit;

proc datasets lib=user;
 	delete est4; 
run;


proc sort data=est5; 
	by est year; 
	run;

data est6; set est5; 
	lcount=lag(count); 
	l2count=lag2(count); 

	if est NE lag(est) then do; 
		lcount=.;
		l2count=.;
	end;
	if est NE lag2(est) then l2count=.;

	empl_boom=(((count-l2count)/count)>0.1 and  count-l2count>10);
	empl_crash=(((l2count-count)/count)>0.1 and  l2count-count>10);

	F9010_nuts1=(sF9010_nuts1-1)/(s_nuts1-1);
	F9910_nuts1=(sF9910_nuts1-1)/(s_nuts1-1);

	F9010_sec=(sF9010_sec-1)/(s_sec-1);
	F9910_sec=(sF9910_sec-1)/(s_sec-1);

	F9010_sz=(sF9010_sz-1)/(s_sz-1);
	F9910_sz=(sF9910_sz-1)/(s_sz-1);

F9010_w=F9010/sF9010;
F9910_w=F9910/sF9910;

F9010xF9010_gap=ABS(F9010xF9010-0.1);
F9910xF9910_gap=ABS(F9910xF9910-0.01);

if F9010>0;
run;



proc datasets lib=user;
 	delete est5; run;
run;


proc means data=est6 N SUMWGT MEAN STD MIN MAX ; 
	var f9010xf9010 F9010xF9010_gap year count lncount F9010_sec F9010_nuts1 F9010_sz ;
	weight f9010; 
	class year;
	output out=rec.des9010;
	where f9010>0;
	run;

	
proc means data=est6 N SUMWGT MEAN STD MIN MAX ; 
	var f9910xf9910 f9910xf9910_gap year count lncount F9910_sec F9910_nuts1 F9910_sz ;
	class year;
	weight f9910; 
	where f9910>0;
	output out=rec.des9910;
run;

ods output OneWayFreqs=rec.freq9010;
proc freq data=est6; 
	tables sector_agg nuts1 orgsize; 
	weight f9010_w; 
run;
ods output close; 

ods output OneWayFreqs=rec.freq9910;
proc freq data=est6; 
	tables sector_agg nuts1 orgsize; 
	weight f9910_w; 
run;
ods output close; 

ods trace on;

data rec.all_est; 
run;
%macro myfile_b(file);
	data &file._e; set &file._e; 
	key=1;
	key2=_N_;
	run;
	data &file._f; set &file._f; 
	key=1;
	keep dependent rsquare key;
	run;
	data &file._n; set &file._n; 
		if _N_/2=int(_N_/2);
	key=1;
	keep N key;
	run;
	data &file._q; set &file._q; 
	key=1;
	if source="Model";
	keep df key;
	run;
	proc sql; create table &file._e2 as select * from &file._e as aa 
			      left join &file._q as bb
						on aa.key=bb.key;
				create table &file._e3 as select * from &file._e2 as aa 
			      left join &file._f as bb
						on aa.key=bb.key;
				create table &file._e as select * from &file._e3 as aa 
			      left join &file._n as bb
						on aa.key=bb.key;
	data &file._e (drop=key); set &file._e; 
		length my_model $40.;
		my_model="&file";
	run;
	proc sort data=&file._e;
    by key2;
    run;
	data rec.all_est; length parameter $100. dependent $40.; set rec.all_est &file._e; 
	if dependent NE "";
	run;
	proc datasets lib=user;
		delete &file._e &file._e2 &file._e3 &file._f &file._n &file._q;
	run;
%mend;

proc glm data=est6; 
	model F9010xF9010=year / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_n 
		FitStatistics=e90_f 
		OverallANOVA=e90_q 
		ParameterEstimates=e90_e;
quit;

%myfile_b(e90); 


proc glm data=est6; 
	class nuts1; 
	model F9010xF9010=year nuts1 / solution ; 
	weight F9010_w; 
	ods output 
		NObs=e90_nu1_n 
		FitStatistics=e90_nu1_f 
		OverallANOVA=e90_nu1_q 
		ParameterEstimates=e90_nu1_e;

	quit;
%myfile_b(e90_nu1); 
proc glm data=est6; 
	class nuts1; 
	model F9010xF9010=year nuts1 F9010_nuts1 nuts1*F9010_nuts1 / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_nu1_y_n 
		FitStatistics=e90_nu1_y_f 
		OverallANOVA=e90_nu1_y_q 
		ParameterEstimates=e90_nu1_y_e;
quit;

%myfile_b(e90_nu1_y); 


proc glm data=est6; 
	class nuts1; 
	model F9010xF9010=year nuts1  F9010_nuts1 nuts1*F9010_nuts1 nuts1*year / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_nu1_y2_n 
		FitStatistics=e90_nu1_y2_f 
		OverallANOVA=e90_nu1_y2_q 
		ParameterEstimates=e90_nu1_y2_e;
quit;
%myfile_b(e90_nu1_y2); 

proc glm data=est6; 
	class orgsize; 
	model F9010xF9010=year orgsize / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sz_n 
		FitStatistics=e90_sz_f 
		OverallANOVA=e90_sz_q 
		ParameterEstimates=e90_sz_e;
quit;
%myfile_b(e90_sz); 

proc glm data=est6; 
	class orgsize; 
	model F9010xF9010=year orgsize orgsize*F9010_sz/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sz_y_n 
		FitStatistics=e90_sz_y_f 
		OverallANOVA=e90_sz_y_q 
		ParameterEstimates=e90_sz_y_e;
quit;

%myfile_b(e90_sz_y); 

proc glm data=est6; 
	class orgsize; 
	model F9010xF9010=year orgsize F9010_sz orgsize*F9010_sz orgsize*year/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sz_y2_n 
		FitStatistics=e90_sz_y2_f 
		OverallANOVA=e90_sz_y2_q 
		ParameterEstimates=e90_sz_y2_e;
quit;

%myfile_b(e90_sz_y2); 

proc glm data=est6; 
	class sector_agg; 
	model F9010xF9010=year sector_agg / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec_n 
		FitStatistics=e90_sec_f 
		OverallANOVA=e90_sec_q 
		ParameterEstimates=e90_sec_e;
quit;
%myfile_b(e90_sec); 

proc glm data=est6; 
	class sector_agg; 
	model F9010xF9010=year sector_agg F9010_sec sector_agg*F9010_sec/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec_y_n 
		FitStatistics=e90_sec_y_f 
		OverallANOVA=e90_sec_y_q 
		ParameterEstimates=e90_sec_y_e;
quit;
%myfile_b(e90_sec_y); 

proc glm data=est6; 
	class sector_agg; 
	model F9010xF9010=year sector_agg F9010_sec sector_agg*F9010_sec sector_agg*year/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec_y2_n 
		FitStatistics=e90_sec_y2_f 
		OverallANOVA=e90_sec_y2_q 
		ParameterEstimates=e90_sec_y2_e;
quit;

%myfile_b(e90_sec_y2); 

proc glm data=est6; 
	class sector_agg nuts1 orgsize ; 
	model F9010xF9010=year sector_agg nuts1 orgsize / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec_nu1_sz_n 
		FitStatistics=e90_sec_nu1_sz_f 
		OverallANOVA=e90_sec_nu1_sz_q 
		ParameterEstimates=e90_sec_nu1_sz_e;
quit;

%myfile_b(e90_sec_nu1_sz); 


proc glm data=est6; 
	class sector_agg nuts1 orgsize; 
	model F9010xF9010=year sector_agg nuts1 orgsize F9010_sec F9010_nuts1 F9010_sz
					F9010_sec*sector_agg F9010_nuts1*nuts1 F9010_sz*orgsize / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec_nu1_sz_y_n 
		FitStatistics=e90_sec_nu1_sz_y_f 
		OverallANOVA=e90_sec_nu1_sz_y_q 
		ParameterEstimates=e90_sec_nu1_sz_y_e;
quit;
%myfile_b(e90_sec_nu1_sz_y); 

/*
proc glm data=est6; 
	class nuts3; 
	model F9010xF9010=year nuts3 / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_nu3_n 
		FitStatistics=e90_nu3_f 
		OverallANOVA=e90_nu3_q 
		ParameterEstimates=e90_nu3_e;
quit;
%myfile_b(e90_nu3); 
*/

proc glm data=est6; 
	absorb est; 
	model F9010xF9010=year / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_n 
		FitStatistics=e90_est_f 
		OverallANOVA=e90_est_q 
		ParameterEstimates=e90_est_e;
quit;

%myfile_b(e90_est); 

proc glm data=est6; 
	absorb est; 
	model F9010xF9010=year lncount/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz_n 
		FitStatistics=e90_est_sz_f 
		OverallANOVA=e90_est_sz_q 
		ParameterEstimates=e90_est_sz_e;
quit;

%myfile_b(e90_est_sz); 

proc glm data=est6; 
	absorb est; 
	model F9010xF9010=year empl_boom empl_crash/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz2_n 
		FitStatistics=e90_est_sz2_f 
		OverallANOVA=e90_est_sz2_q 
		ParameterEstimates=e90_est_sz2_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e90_est_sz2); 

proc glm data=est6; 
	absorb est; 
	class year;
	model F9010xF9010=year lncount/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz3_n 
		FitStatistics=e90_est_sz3_f 
		OverallANOVA=e90_est_sz3_q 
		ParameterEstimates=e90_est_sz3_e;
quit;

%myfile_b(e90_est_sz3); 

proc glm data=est6; 
	absorb est; 
	class year;
	model F9010xF9010=year empl_boom empl_crash/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz4_n 
		FitStatistics=e90_est_sz4_f 
		OverallANOVA=e90_est_sz4_q 
		ParameterEstimates=e90_est_sz4_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e90_est_sz4);

proc glm data=est6; 
	absorb est; 
	class year;
	model F9010xF9010_gap=year lncount/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz5_n 
		FitStatistics=e90_est_sz5_f 
		OverallANOVA=e90_est_sz5_q 
		ParameterEstimates=e90_est_sz5_e;
quit;

%myfile_b(e90_est_sz5); 

proc glm data=est6; 
	absorb est; 
	class year;
	model F9010xF9010_gap=year empl_boom empl_crash/ solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_est_sz6_n 
		FitStatistics=e90_est_sz6_f 
		OverallANOVA=e90_est_sz6_q 
		ParameterEstimates=e90_est_sz6_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e90_est_sz6);
 


proc sort data=est6; 
	by sector; 
	run;

proc glm data=est6; 
	absorb sector; 
	model F9010xF9010=year / solution; 
	weight F9010_w; 
	ods output 
		NObs=e90_sec4_n 
		FitStatistics=e90_sec4_f 
		OverallANOVA=e90_sec4_q 
		ParameterEstimates=e90_sec4_e;
quit;

%myfile_b(e90_sec4); 

proc sort data=est6; 
	by est year; 
run;

************;
* F9910 *;

proc glm data=est6; 
	model F9910xF9910=year / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_n 
		FitStatistics=e99_f 
		OverallANOVA=e99_q 
		ParameterEstimates=e99_e;
quit;

%myfile_b(e99); 


proc glm data=est6; 
	class nuts1; 
	model F9910xF9910=year nuts1 / solution ; 
	weight F9910_w; 
	ods output 
		NObs=e99_nu1_n 
		FitStatistics=e99_nu1_f 
		OverallANOVA=e99_nu1_q 
		ParameterEstimates=e99_nu1_e;

	quit;
%myfile_b(e99_nu1); 
proc glm data=est6; 
	class nuts1; 
	model F9910xF9910=year nuts1 F9910_nuts1 nuts1*F9910_nuts1 / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_nu1_y_n 
		FitStatistics=e99_nu1_y_f 
		OverallANOVA=e99_nu1_y_q 
		ParameterEstimates=e99_nu1_y_e;
quit;

%myfile_b(e99_nu1_y); 


proc glm data=est6; 
	class nuts1; 
	model F9910xF9910=year nuts1  F9910_nuts1 nuts1*F9910_nuts1 nuts1*year / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_nu1_y2_n 
		FitStatistics=e99_nu1_y2_f 
		OverallANOVA=e99_nu1_y2_q 
		ParameterEstimates=e99_nu1_y2_e;
quit;
%myfile_b(e99_nu1_y2); 

proc glm data=est6; 
	class orgsize; 
	model F9910xF9910=year orgsize / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sz_n 
		FitStatistics=e99_sz_f 
		OverallANOVA=e99_sz_q 
		ParameterEstimates=e99_sz_e;
quit;
%myfile_b(e99_sz); 

proc glm data=est6; 
	class orgsize; 
	model F9910xF9910=year orgsize orgsize*F9910_sz/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sz_y_n 
		FitStatistics=e99_sz_y_f 
		OverallANOVA=e99_sz_y_q 
		ParameterEstimates=e99_sz_y_e;
quit;

%myfile_b(e99_sz_y); 

proc glm data=est6; 
	class orgsize; 
	model F9910xF9910=year orgsize F9910_sz orgsize*F9910_sz orgsize*year/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sz_y2_n 
		FitStatistics=e99_sz_y2_f 
		OverallANOVA=e99_sz_y2_q 
		ParameterEstimates=e99_sz_y2_e;
quit;

%myfile_b(e99_sz_y2); 

proc glm data=est6; 
	class sector_agg; 
	model F9910xF9910=year sector_agg / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec_n 
		FitStatistics=e99_sec_f 
		OverallANOVA=e99_sec_q 
		ParameterEstimates=e99_sec_e;
quit;
%myfile_b(e99_sec); 

proc glm data=est6; 
	class sector_agg; 
	model F9910xF9910=year sector_agg F9910_sec sector_agg*F9910_sec/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec_y_n 
		FitStatistics=e99_sec_y_f 
		OverallANOVA=e99_sec_y_q 
		ParameterEstimates=e99_sec_y_e;
quit;
%myfile_b(e99_sec_y); 

proc glm data=est6; 
	class sector_agg; 
	model F9910xF9910=year sector_agg F9910_sec sector_agg*F9910_sec sector_agg*year/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec_y2_n 
		FitStatistics=e99_sec_y2_f 
		OverallANOVA=e99_sec_y2_q 
		ParameterEstimates=e99_sec_y2_e;
quit;

%myfile_b(e99_sec_y2); 

proc glm data=est6; 
	class sector_agg nuts1 orgsize ; 
	model F9910xF9910=year sector_agg nuts1 orgsize / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec_nu1_sz_n 
		FitStatistics=e99_sec_nu1_sz_f 
		OverallANOVA=e99_sec_nu1_sz_q 
		ParameterEstimates=e99_sec_nu1_sz_e;
quit;

%myfile_b(e99_sec_nu1_sz); 


proc glm data=est6; 
	class sector_agg nuts1 orgsize; 
	model F9910xF9910=year sector_agg nuts1 orgsize F9910_sec F9910_nuts1 F9910_sz
					F9910_sec*sector_agg F9910_nuts1*nuts1 F9910_sz*orgsize / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec_nu1_sz_y_n 
		FitStatistics=e99_sec_nu1_sz_y_f 
		OverallANOVA=e99_sec_nu1_sz_y_q 
		ParameterEstimates=e99_sec_nu1_sz_y_e;
quit;
%myfile_b(e99_sec_nu1_sz_y); 

/*
proc glm data=est6; 
	class nuts3; 
	model F9910xF9910=year nuts3 / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_nu3_n 
		FitStatistics=e99_nu3_f 
		OverallANOVA=e99_nu3_q 
		ParameterEstimates=e99_nu3_e;
quit;
%myfile_b(e99_nu3); 
*/


proc glm data=est6; 
	absorb est; 
	model F9910xF9910=year / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_n 
		FitStatistics=e99_est_f 
		OverallANOVA=e99_est_q 
		ParameterEstimates=e99_est_e;
quit;

%myfile_b(e99_est); 

proc glm data=est6; 
	absorb est; 
	model F9910xF9910=year lncount/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz_n 
		FitStatistics=e99_est_sz_f 
		OverallANOVA=e99_est_sz_q 
		ParameterEstimates=e99_est_sz_e;
quit;
%myfile_b(e99_est_sz); 

proc glm data=est6; 
	absorb est; 
	model F9910xF9910=year empl_boom empl_crash/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz2_n 
		FitStatistics=e99_est_sz2_f 
		OverallANOVA=e99_est_sz2_q 
		ParameterEstimates=e99_est_sz2_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e99_est_sz2); 


proc glm data=est6; 
	absorb est; 
	class year;
	model F9910xF9910=year lncount/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz3_n 
		FitStatistics=e99_est_sz3_f 
		OverallANOVA=e99_est_sz3_q 
		ParameterEstimates=e99_est_sz3_e;
quit;

%myfile_b(e99_est_sz3); 

proc glm data=est6; 
	absorb est; 
	class year;
	model F9910xF9910=year empl_boom empl_crash/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz4_n 
		FitStatistics=e99_est_sz4_f 
		OverallANOVA=e99_est_sz4_q 
		ParameterEstimates=e99_est_sz4_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e99_est_sz4);

proc glm data=est6; 
	absorb est; 
	class year;
	model F9910xF9910_gap=year lncount/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz5_n 
		FitStatistics=e99_est_sz5_f 
		OverallANOVA=e99_est_sz5_q 
		ParameterEstimates=e99_est_sz5_e;
quit;

%myfile_b(e99_est_sz5); 

proc glm data=est6; 
	absorb est; 
	class year;
	model F9910xF9910_gap=year empl_boom empl_crash/ solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_est_sz6_n 
		FitStatistics=e99_est_sz6_f 
		OverallANOVA=e99_est_sz6_q 
		ParameterEstimates=e99_est_sz6_e;
	where l2count>0 and count>50;
quit;
%myfile_b(e99_est_sz6);
 

proc sort data=est6; 
	by sector; 
	run;

proc glm data=est6; 
	absorb sector; 
	model F9910xF9910=year / solution; 
	weight F9910_w; 
	ods output 
		NObs=e99_sec4_n 
		FitStatistics=e99_sec4_f 
		OverallANOVA=e99_sec4_q 
		ParameterEstimates=e99_sec4_e;
	
quit;


%myfile_b(e99_sec4); 

proc sort data=est6; 
	by est year; 
run;
